home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / lyaplib / create_lyap_windows.c next >
Encoding:
C/C++ Source or Header  |  1990-01-19  |  2.6 KB  |  96 lines

  1. /*
  2. ### create a lyapunov window ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/panel.h>
  7.  
  8. void create_lyap_windows()
  9. {
  10.     void lyap_quit_proc(),lyap_go_proc();
  11.     void lyap_algorithm_option_proc();
  12.     int i,ipanel_row=0,px,py;
  13.     extern Frame frame,lyap_frame,tser_frame;
  14.     extern Panel lyap_panel;
  15.     extern Pixfont *boldfont;
  16.     extern Panel_item lyap_quit_item,lyap_go_item;
  17.     extern Panel_item lyap_algorithm_option_item;
  18.     extern short lyap_panel_show,tser_panel_show;
  19.     extern int panel_colormap_on;
  20.     extern int lyap_algorithm_option;
  21.     extern char string[];
  22.     
  23.     /* Turn on the flag */    
  24.     if(lyap_panel_show){
  25.         window_set(lyap_frame,WIN_SHOW,TRUE,0);    
  26.         return;
  27.     }
  28.     else
  29.         lyap_panel_show = 1;
  30.  
  31.     if(tser_panel_show){
  32.         px = (int) window_get(tser_frame,WIN_X);
  33.         py = (int) window_get(tser_frame,WIN_Y) + (int) window_get(tser_frame,WIN_HEIGHT) + 50;
  34.     }
  35.     else {
  36.         px = (int) window_get(frame,WIN_X) + (int) window_get(frame,WIN_WIDTH)/2;
  37.         py = (int) window_get(frame,WIN_Y) + (int) window_get(frame,WIN_HEIGHT) /2 + 50;
  38.     }
  39.     /* Create tser frame */
  40.     lyap_frame = window_create(frame,FRAME,
  41.         FRAME_NO_CONFIRM,       TRUE,
  42.         FRAME_LABEL,    "Lyapunov",
  43.         FRAME_SHOW_LABEL,       TRUE,
  44.         WIN_SHOW,       TRUE,
  45.         WIN_X,  px,
  46.         WIN_Y,  py,
  47.         WIN_FONT, boldfont,
  48.         0);
  49.     if(lyap_frame == NULL) {
  50.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  51.         lyap_panel_show = 0;
  52.         return;
  53.     }
  54.     /* Create Panel */
  55.     lyap_panel = window_create(lyap_frame, PANEL,
  56.         WIN_X, 0,
  57.         WIN_Y, 0,
  58.         WIN_FONT, boldfont,
  59.         0);
  60.     if(lyap_panel == NULL) {
  61.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  62.         (void) destroy_lyap_windows();
  63.         return;
  64.     }
  65.     /* Create panel items */
  66.     lyap_quit_item= panel_create_item(lyap_panel, PANEL_BUTTON,
  67.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  68.         PANEL_LABEL_X, ATTR_COL(0),
  69.         PANEL_LABEL_IMAGE, panel_button_image(lyap_panel, "Quit", 5, boldfont),
  70.         PANEL_NOTIFY_PROC, lyap_quit_proc,
  71.         0);
  72.     lyap_go_item= panel_create_item(lyap_panel, PANEL_BUTTON,
  73.         PANEL_LABEL_IMAGE, panel_button_image(lyap_panel, "Go", 5, boldfont),
  74.         PANEL_NOTIFY_PROC, lyap_go_proc,
  75.         0);
  76.     lyap_algorithm_option_item= panel_create_item(lyap_panel, PANEL_CYCLE,
  77.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  78.         PANEL_LABEL_X, ATTR_COL(0),
  79.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  80.         PANEL_LABEL_STRING, "Algorithm: ",
  81.         PANEL_CHOICE_STRINGS,
  82.             "Wolf's",
  83.             "User algorithm A",
  84.             "User algorithm B",
  85.             0,
  86.         PANEL_VALUE, lyap_algorithm_option,
  87.         PANEL_NOTIFY_PROC, lyap_algorithm_option_proc,
  88.         0);
  89.  
  90.     window_fit(lyap_panel);
  91.     window_fit(lyap_frame);
  92.  
  93.     if(panel_colormap_on)
  94.         init_panel_colormap((Pixwin *) window_get(lyap_panel,WIN_PIXWIN),"lyap_panel_cms");
  95. }
  96.